package cn.edu.xmu.oomall.customer.controller.vo;


import cn.edu.xmu.javaee.core.aop.CopyFrom;
import cn.edu.xmu.javaee.core.model.vo.IdNameTypeVo;
import cn.edu.xmu.oomall.customer.dao.bo.Address;
import cn.edu.xmu.oomall.customer.dao.bo.Coupon;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@CopyFrom({Coupon.class})
public class CouponVo {
    private Long id;
    private String name;
    private String couponSn;
    private ActivityVo activity;
    private IdNameTypeVo creator;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;
    private IdNameTypeVo modifier;

    public CouponVo(Coupon coupon){
        this();
        this.setActivity1(ActivityVo.builder().id(coupon.getCouponAct().getId())
                .name(coupon.getCouponAct().getName()).quantity(coupon.getCouponAct().getQuantity())
                .couponTime(coupon.getCouponAct().getCouponTime()).build());
        this.setCreator(IdNameTypeVo.builder().id(coupon.getCreatorId())
                .name(coupon.getCreatorName()).build());
        this.setModifier(IdNameTypeVo.builder().id(coupon.getModifierId())
                .name(coupon.getModifierName()).build());
    }

    public void setActivity(ActivityVo activity) {
        this.activity = activity;
    }

    public IdNameTypeVo getCreator() {
        return creator;
    }

    public void setCreator(IdNameTypeVo creator) {
        this.creator = creator;
    }

    public LocalDateTime getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(LocalDateTime gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public LocalDateTime getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(LocalDateTime gmtModified) {
        this.gmtModified = gmtModified;
    }

    public IdNameTypeVo getModifier() {
        return modifier;
    }

    public void setModifier(IdNameTypeVo modifier) {
        this.modifier = modifier;
    }

    public ActivityVo getActivity() {
        return activity;
    }

    public void setActivity1(ActivityVo activity) {
        this.activity = activity;
    }

    public String getCouponSn() {
        return couponSn;
    }

    public void setCouponSn(String couponSn) {
        this.couponSn = couponSn;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
